#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int arr[50];
	int n;
	int flag = 1;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}
	int big=arr[0], small=arr[0];
	for (int i = 0; i < n; i++)
	{
		if (arr[i] > big)big = arr[i];
		if (arr[i] < small)small = arr[i];
	}
	printf("%d",big-small);
	return 0;
}